package cn.bearspark.idgenerator.provider.rpc;

import cn.bearspark.idgenerator.enumeration.IdCodeEnum;
import cn.bearspark.idgenerator.provider.service.IdGeneratorService;
import cn.bearspark.idgenerator.rpc.IdGeneratorRpc;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.stereotype.Component;

/**
 * @author f
 */
@Component
@DubboService
public class IdGeneratorRpcImpl implements IdGeneratorRpc {

    private final IdGeneratorService idGeneratorService;

    public IdGeneratorRpcImpl(IdGeneratorService idGeneratorService) {
        this.idGeneratorService = idGeneratorService;
    }

    @Override
    public Long generateId(IdCodeEnum idCode) {
        return idGeneratorService.generateId(idCode);
    }

}
